/*
 * @Author: your name
 * @Date: 2021-12-01 03:43:58
 * @LastEditTime: 2021-12-01 03:58:55
 * @LastEditors: your name
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \esp8266-oled7240-arduino\include\oled.h
 */
#ifndef __OLED_H
#define __OLED_H 
#include "Arduino.h"
// #include "sys.h"
// #include "stdlib.h"	

#define BLACK 0
#define WHITE 0XFF

#define OLED_Width 72
#define OLED_High  40


// IIC_SDA -> GPIO5
// IIC_SCL -> GPIO4
#define LED_ON()  digitalWrite(2,LOW)
#define LED_OFF() digitalWrite(2,HIGH)

//-----------------OLED端口定义---------------- 
#define OLED_SCLK_Clr() digitalWrite(4,LOW)
#define OLED_SCLK_Set() digitalWrite(4,HIGH)//SCL



#define OLED_SDIN_Clr() digitalWrite(5,LOW)//DIN
#define OLED_SDIN_Set() digitalWrite(5,HIGH)



#define OLED_CMD  0	//写命令
#define OLED_DATA 1	//写数据
#define x_offset 28  //x轴偏移量

void OLED_ClearPoint(uint8_t x,uint8_t y);
void OLED_ColorTurn(uint8_t i);
void OLED_DisplayTurn(uint8_t i);
void I2C_Start(void);
void I2C_Stop(void);
void I2C_WaitAck(void);
void Send_Byte(uint8_t dat);
void OLED_WR_Byte(uint8_t dat,uint8_t mode);
void OLED_DisPlay_On(void);
void OLED_DisPlay_Off(void);
void OLED_Refresh(void);
void OLED_Clear(void);

void OLED_DrawPoint(uint8_t x,uint8_t y);
void OLED_ShowChar(uint8_t x,uint8_t y,uint8_t chr,uint8_t size1);
void OLED_ShowString(uint8_t x,uint8_t y,char *chr,uint8_t size1);
void OLED_ShowNum(uint8_t x,uint8_t y,u32 num,uint8_t len,uint8_t size1);
void OLED_ShowChinese(uint8_t x,uint8_t y,uint8_t num,uint8_t size1);
void OLED_ScrollDisplay(uint8_t num,uint8_t space);
void OLED_WR_BP(uint8_t x,uint8_t y);
void OLED_ShowPicture(uint8_t x,uint8_t y,uint8_t width,uint8_t length,const uint8_t *pic);
void OLED_Init(void);
void OLED_Fill(void);

void OLED_RefreshPage(uint8_t page);
void OLED_ClearPage(uint8_t page,uint8_t color);

void OLED_Fill(uint8_t color);

void OLED_Debug(char *str,bool line,uint8_t Font_size);

void OLED_ClearLine(uint8_t x1,uint8_t y1,uint8_t x2,uint8_t y2);
void DrawLine(int x1,int y1,int x2,int y2);

void FillByte(int page,int x,unsigned  char byte);
void FillRect(int x,int y,int width,int height);



#endif
